// pages/user/index.js
const app = getApp()

Page({

  /**
   * 页面的初始数据
   */
  data: {
    name:"",
    studentId:"",
    college:"",
    // 用户微信头像
    avatarUrl:"",
    // 用户是否登录
    isLogin: false,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    
  },

  onShow: function(){
    var that = this
    that.setData({
      isLogin: app.globalData.isLogin,
      name: app.globalData.name,
      studentId: app.globalData.studentId,
      college: app.globalData.college,
    })
    console.log("_________________")
    console.log(that.data.isLogin)
  },

  getUserInfo(){
    var that = this
    wx.request({
      url: 'https://example.com/user',
      dataType: 'json',
      success(res){
        console.log(res)
        that.setData({
          name: res.data.name,
          studentId: res.data.studentId,
          college: res.data.college
        })
    }
    })
  },

})